package org.rugby.online.impl;

import static org.junit.Assert.*;

import org.junit.Before;
import org.junit.Test;
import org.rugby.online.core.economy.RboTransferDescription;
import org.rugby.online.core.economy.RboTransferType;
import org.rugby.online.impl.DefaultEconomy;
import org.rugby.online.impl.DefaultTransferDescription;

public class DefaultEconomyTest {

	private DefaultEconomy economy;
	
	@Before
	public void setUp() throws Exception {
		economy = new DefaultEconomy(1L);
		RboTransferDescription descr1 = new DefaultTransferDescription(2L, 1L, 100, 0, RboTransferType.INCOME_SINGLE);
		RboTransferDescription descr2 = new DefaultTransferDescription(1L, 3L, 20, 0, RboTransferType.OUTCOME_SINGLE);
		economy.getTransferDescription().add(descr1);
		economy.getTransferDescription().add(descr2);
	}

	@Test
	public void testGetTransferDescription() {
		assertTrue(economy.getTransferDescription().size() == 2);
	}

	@Test
	public void testGetCurrentBalance() {
		assertTrue(economy.getCurrentBalance() == 80);
	}

	@Test
	public void testGetTotalIncomeForSeason() {
		assertTrue(economy.getTotalIncomeForSeason(0) == 100);
		assertTrue(economy.getTotalIncomeForSeason(1) == 0);
	}

	@Test
	public void testGetTotalOutcomeForSeason() {
		assertTrue(economy.getTotalOutcomeForSeason(0) == 20);
		assertTrue(economy.getTotalOutcomeForSeason(1) == 0);
	}

	@Test
	public void testGetGamerId() {
		assertTrue(economy.getGamerId() == 1L);
	}

	@Test
	public void testGetName() {
		assertTrue(economy.getName().equals("ECONOMY_1"));
	}

	@Test
	public void testGetId() {
		assertNotNull(economy.getId());
	}

}
